<template>
	<view>
		<view>
			<uni-section v-for="(em,index) in employmenMaintainList" :key="" :title="'维护时间：'+em.createTime" type="line">
						<!-- <uni-group mode="card">
							<view> 分组内容 </view>
							<view> 分组内容 </view>
							<view> 分组内容 </view>
							<view> 分组内容 </view>
						</uni-group> -->
			
						<uni-group :title="'维护编号：'+em.maintainerId" mode="card">
							<view>
								<span style="font-size: 15px;color: grey;">维护人：</span>
								<text style="font-size: 14px;margin-left: 92rpx;">{{em.maintainer}}</text>
							</view>
							<u-gap height="10" bgColor="#ffffff"></u-gap>
							
							<view> 
								<span style="font-size: 15px;color: grey;">维护人编号：</span>
								<text style="font-size: 12px;">{{em.maintainerId}}</text>
							</view>
							<u-gap height="10" bgColor="#ffffff"></u-gap>
							
							<view>
								<span style="font-size: 15px;color: grey;">维护方式：</span>
								<text style="font-size: 14px;margin-left: 62rpx;">{{em.maintainMode}}</text>
							</view>
							<u-gap height="10" bgColor="#ffffff"></u-gap>
							
							<view>
								<span style="font-size: 15px;color: grey;">当前所在城市：</span>
								<text style="font-size: 14px;">{{getPcaText(em.currentLocation)}}</text>
							</view>
							<u-gap height="10" bgColor="#ffffff"></u-gap>
							
							<view>
								<span style="font-size: 15px;color: grey;">是否转正：</span>
								<text style="font-size: 14px;margin-left: 65rpx;">{{em.regularization}}</text>
							</view>
							<u-gap height="10" bgColor="#ffffff"></u-gap>
							
							<view>
								<span style="font-size: 15px;color: grey;">薪资变化：</span>
								<text style="font-size: 14px;margin-left: 65rpx;">{{em.changeMoney}}</text>
							</view>
							<u-gap height="10" bgColor="#ffffff"></u-gap>
							
							<view>
								<span style="font-size: 15px;color: grey;">职位变化：</span>
								<text style="font-size: 14px;margin-left: 65rpx;">{{em.changePosition}}</text>
							</view>
							<u-gap height="10" bgColor="#ffffff"></u-gap>
							
							<view>
								<span style="font-size: 15px;color: grey;">是否换工作：</span>
								<text style="font-size: 14px;margin-left: 35rpx;">{{em.changeJob}}</text>
							</view>
							<u-gap height="10" bgColor="#ffffff"></u-gap>
							
							<view>
								<span style="font-size: 15px;color: grey;">是否需要协助：</span>
								<text style="font-size: 14px;margin-left: 5rpx;">{{em.helpRequest=='0'?'是':'否'}}</text>
							</view>
							<u-gap height="10" bgColor="#ffffff"></u-gap>
							
							<view v-if="em.helpRequest==0">
								<span style="font-size: 15px;color: grey;">协助状态：</span>
								<text style="font-size: 14px;margin-left: 65rpx;">{{em.helpStatus==0?'待解决':(em.helpStatus==1?'已解决':'未解决')}}</text>
							</view>
							<u-gap v-if="em.helpRequest==0" height="10" bgColor="#ffffff"></u-gap>
							
							<view>
								<span style="font-size: 15px;color: grey;">遇到的问题：</span>
								<u-read-more
								:shadowStyle="shadowStyle" 
								textIndent="6em" 
								:toggle="true" 
								closeText="展开阅读全部"
								showHeight="20"
								style="position: relative;left: 10rpx;">
										<rich-text :nodes="em.maintainQuestion"></rich-text>
								</u-read-more>
							</view>
							<u-gap height="10" bgColor="#ffffff"></u-gap>
							
						</uni-group>
			</uni-section>
		</view>	
			<!-- 加载状态显示 -->
		<view>
			<uni-load-more 
			iconType="circle" 
			:status="status" 
			:content-text="contentText"
			@click="clickLoadMore()"/>
		</view>	
			
	</view>
</template>

<script>
	
	import data from 'china-area-data'
	import Area from './utils/Area.js'
	
	
	export default {
		data() {
			return {
				stuId:'',
				pcaData:'',
				employmenMaintainList:[],
				pageInfo:{
					pageNo:1,
					pageSize:5,
				},
				shadowStyle: {
					backgroundImage: "none",
					paddingTop: "0",
					marginTop: "20rpx"
				},
				contentText: {
					contentdown: '查看更多',
					contentrefresh: '加载中',
					contentnomore: '没有更多'
				},
				status: 'loading',
				Urls:{
					showEmployMaintainByStuId:'/maintain/employmenMaintain/showEmployMaintainByStuId',
				}
			}
		},
		onLoad(option){
			if(JSON.stringify(option)!="{}"){
				this.stuId=option.stuId;
			}
		},
		onShow(){
			if(this.stuId!=""){
				this.sleep(2000).then(() => {
					this.showEmployMaintainByStuId();
				});
			}
		
		},
		created() {
			 this.pcaData = new Area();
				this.sleep(2000).then(() => {
					this.showEmployMaintainByStuId();
				});
		},
		methods: {
			
			/* 瀑布流-查看更多 */
			/* 回显0-5页的试听预约 */
			showEmployMaintainByStuId(){//展示当前登录学生所有的就业维护信息【维护日志】
				this.$axios.post(this.Urls.showEmployMaintainByStuId+"?stuId="+this.stuId+"&pageNo="+this.pageInfo.pageNo+"&pageSize="+this.pageInfo.pageSize).then(res=>{
					console.log(res)
					if(res.data.success){
						this.employmenMaintainList=res.data.result.records;
						if(res.data.result.records.length==0){
							this.status='noMore';
						}else{
							this.status='more';
						}
						
					}
				});
			},
			/* 睡眠方法 */
			sleep (time) {
			  return new Promise((resolve) => setTimeout(resolve, time));
			},
			getPcaText(code){//就业城市---地区号反推地区名
			       return this.pcaData.getText(code);
			},
			onReachBottom(){
				/* 瀑布流  回显下一页的试听预约 */
				this.sleep(1000).then(() => {
					this.status='loading';
				});
				this.pageInfo.pageNo++;
				
				this.sleep(2000).then(() => {
				    // 这里写sleep之后需要去做的事情
					
					this.$axios.post(this.Urls.showEmployMaintainByStuId+"?stuId="+this.stuId+"&pageNo="+this.pageInfo.pageNo+"&pageSize="+this.pageInfo.pageSize).then(res=>{
						console.log(res)
						if(res.data.success){
							this.employmenMaintainList=this.employmenMaintainList.concat(res.data.result.records);
							if(res.data.result.records.length==0){
								this.status='noMore';
							}else{
								this.status='more';
							}
							
						}
					});
				})
				
			}
			
		}
	}
</script>

<style>
	
</style>
